Leon 2 년 전
부모
커밋
00b45b5e90
7개의 변경된 파일41개의 추가작업 그리고 16개의 파일을 삭제
  1. 1 1
      ios/main.jsbundle
  2. 1 0
      package.json
  3. 20 0
      src/components/basic/GradientText.tsx
  4. 2 5
      src/features/trackTimeDuration/actions/TrackTimeActions.tsx
  5. 9 7
      src/pages/clock/demoA.tsx
  6. 3 3
      src/pages/rn/RNMain.tsx
  7. 5 0
      yarn.lock

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
ios/main.jsbundle


+ 1 - 0
package.json

@@ -93,6 +93,7 @@
 		"react-native": "^0.70.1",
 		"react-native-device-info": "~10.3.0",
 		"react-native-gesture-handler": "~2.9.0",
+		"react-native-linear-gradient": "^2.8.3",
 		"react-native-pager-view": "~6.0.1",
 		"react-native-safe-area-context": "~4.4.1",
 		"react-native-screens": "^3.18.2",

+ 20 - 0
src/components/basic/GradientText.tsx

@@ -0,0 +1,20 @@
+import React from "react";
+import { Text } from "react-native";
+import MaskedView from "@react-native-masked-view/masked-view";
+import LinearGradient from "react-native-linear-gradient";
+    
+const GradientText = (props) => {
+  return (
+    <MaskedView maskElement={<Text {...props} />}>
+      <LinearGradient
+        colors={["red", "blue"]}
+        start={{ x: 0, y: 0 }}
+        end={{ x: 0.3, y: 0 }}
+      >
+        <Text {...props} style={[props.style, { opacity: 0 }]} />
+      </LinearGradient>
+    </MaskedView>
+  );
+};
+
+export default GradientText;

+ 2 - 5
src/features/trackTimeDuration/actions/TrackTimeActions.tsx

@@ -3,8 +3,7 @@ import trackTimeService, { machine } from "@/store/trackTimeMachine"
 
 export const startFast = (start_time: number, duration: number) => {
     return new Promise((resolve) => {
-        duration = duration < 3600 * 1000 ? 3600 * 1000 : duration;
-        // const duration = fastValues[0] * 3600 * 1000 + fastValues[1] * 60 * 1000
+        // duration = duration < 3600 * 1000 ? 3600 * 1000 : duration;
         const extra = {
             set_time: global.set_time,
             confirm_time: new Date().getTime(),
@@ -42,8 +41,7 @@ export const endFast = (start_time: number) => {
 
 
 export const startSleep = (start_time: number, duration: number) => {
-    duration = duration < 3600 * 1000 ? 3600 * 1000 : duration;
-    // const duration = sleepValues[0] * 3600 * 1000 + sleepValues[1] * 60 * 1000
+    // duration = duration < 3600 * 1000 ? 3600 * 1000 : duration;
     const extra = {
         set_time: global.set_time,
         confirm_time: new Date().getTime(),
@@ -61,7 +59,6 @@ export const startSleep = (start_time: number, duration: number) => {
     });
 }
 export const endSleep = (start_time: number) => {
-    // const duration = 8 * 3600 * 1000;
     const extra = {
         set_time: global.set_time,
         confirm_time: new Date().getTime(),

+ 9 - 7
src/pages/clock/demoA.tsx

@@ -1,3 +1,4 @@
+import GradientText from "@/components/basic/GradientText";
 import { View, PickerView, PickerViewColumn } from "@tarojs/components";
 import { useEffect, useLayoutEffect, useRef, useState } from "react";
 import { LayoutChangeEvent, Text } from "react-native";
@@ -6,18 +7,18 @@ export default function DemoA() {
     useEffect(() => {
     }, [])
 
-    const years = [0,1,2,3,4,5]
-    const months = [0,1,2,3,4,5]
-    const days = [0,1,2,3,4,5]
+    const years = [0, 1, 2, 3, 4, 5]
+    const months = [0, 1, 2, 3, 4, 5]
+    const days = [0, 1, 2, 3, 4, 5]
 
     return (
-        <View style={{ backgroundColor: 'blue', height: 800, width: 375 }} >
+        <View style={{ backgroundColor: 'white', height: 800, width: 375 }} >
             <Text style={{ color: 'red', fontSize: 50 }}>hello world</Text>
-            <PickerView title="hhhh" itemStyle={{color:'#fff',fonSize:10}} indicatorStyle='height: 50px;' style='width: 100%; height: 300px;color:white' value={[0,1,2,3,4]} onChange={(e)=>{}}>
-                <PickerViewColumn style={{color:'#fff'}}>
+            <PickerView title="hhhh" itemStyle={{ color: '#000', fonSize: 10 }} indicatorStyle='height: 50px;' style='width: 100%; height: 300px;color:white' value={[0, 1, 2, 3, 4]} onChange={(e) => { }}>
+                <PickerViewColumn style={{ color: '#fff' }}>
                     {years.map(item => {
                         return (
-                            <View style={{color:'white',opacity:0,backgroundColor:'pink'}}>{item}年</View>
+                            <View style={{ color: 'white', opacity: 0, backgroundColor: 'pink' }}>{item}年</View>
                         );
                     })}
                 </PickerViewColumn>
@@ -36,6 +37,7 @@ export default function DemoA() {
                     })}
                 </PickerViewColumn>
             </PickerView>
+            <GradientText style={{fontSize:20}}>Hello world</GradientText>
         </View>
     );
 }

+ 3 - 3
src/pages/rn/RNMain.tsx

@@ -18,7 +18,7 @@ import EditPage from '@/pages/account/EditPage'
 import Food from '@/pages/food/Food'
 import Working from '@/pages/workout/Working'
 import WorkoutDetail from '@/pages/workout/WorkoutDetail'
-// import DemoA from '../clock/demoA';
+import DemoA from '../clock/demoA';
 import { View } from '@tarojs/components';
 
 // 创建底部 Tab 导航器
@@ -65,7 +65,7 @@ export default function RNMain() {
   const MetricPage = () => <Metric />
   const WorkoutPage = () => <Workout />
   const ProfilePage = () => <Profile />
-  // const DemoAPage = () => <DemoA />
+  const DemoAPage = () => <DemoA />
   // const FoodPage = ()=><Food/>
 
   function tabNavigator() {
@@ -81,7 +81,7 @@ export default function RNMain() {
         tabBarInactiveTintColor: 'gray', // 非活动标签的颜色
       })}>
         <Tab.Screen name="Clock" component={ClockPage} />
-        {/* <Tab.Screen name='DemoA' component={DemoAPage} /> */}
+        <Tab.Screen name='DemoA' component={DemoAPage} />
         {/* <Tab.Screen name="Food" component={FoodPage} /> */}
         <Tab.Screen name="Metric" component={MetricPage} />
         <Tab.Screen name="Workout" component={WorkoutPage} />

+ 5 - 0
yarn.lock

@@ -13641,6 +13641,11 @@ react-native-known-styling-properties@^1.0.4:
   resolved "https://registry.npmmirror.com/react-native-known-styling-properties/-/react-native-known-styling-properties-1.2.0.tgz#5370f87af605c6c516178bac4eb1493cdf160f36"
   integrity sha512-nrsxo8t1FjMJILe9hoRC1WtfXw7gBs/Cq7Gcts8soDDhN0RjoFu9bJtphJGYC2fs9B2ANYOdEoP4B4tiinkwgw==
 
+react-native-linear-gradient@^2.8.3:
+  version "2.8.3"
+  resolved "https://registry.yarnpkg.com/react-native-linear-gradient/-/react-native-linear-gradient-2.8.3.tgz#9a116649f86d74747304ee13db325e20b21e564f"
+  integrity sha512-KflAXZcEg54PXkLyflaSZQ3PJp4uC4whM7nT/Uot9m0e/qxFV3p6uor1983D1YOBJbJN7rrWdqIjq0T42jOJyA==
+
 react-native-maps@^1.3.2:
   version "1.7.1"
   resolved "https://registry.npmmirror.com/react-native-maps/-/react-native-maps-1.7.1.tgz#e0b9d68542b4b59b5ca3df375ada7c860fb41f2e"

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.