-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #890 from thundersdata-frontend/rn-issue
删除 `react-native-redash`依赖
- Loading branch information
Showing
20 changed files
with
105 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@td-design/react-native-calendar': patch | ||
'@td-design/react-native-picker': patch | ||
'@td-design/react-native-rating': patch | ||
'@td-design/react-native': patch | ||
--- | ||
|
||
删除 `react-native-redash`依赖 | ||
优化`react-native-picker` 的`onChange`事件的参数类型问题 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
{ | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
"eslint.validate": ["javascript", "typescript", "json", "md"] | ||
"eslint.validate": [ | ||
"javascript", | ||
"typescript", | ||
"json", | ||
"md" | ||
], | ||
"cSpell.words": [ | ||
"dayjs" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import type { TextProps as RNTextProps, TextInputProps } from 'react-native'; | ||
import { StyleSheet, TextInput } from 'react-native'; | ||
import Animated, { useAnimatedProps } from 'react-native-reanimated'; | ||
|
||
const styles = StyleSheet.create({ | ||
baseStyle: { | ||
color: 'black', | ||
}, | ||
}); | ||
Animated.addWhitelistedNativeProps({ text: true }); | ||
|
||
interface TextProps extends Omit<TextInputProps, 'value' | 'style'> { | ||
text: Animated.SharedValue<string>; | ||
style?: Animated.AnimateProps<RNTextProps>['style']; | ||
} | ||
|
||
const AnimatedTextInput = Animated.createAnimatedComponent(TextInput); | ||
|
||
const ReText = (props: TextProps) => { | ||
const { style, text, ...rest } = props; | ||
const animatedProps = useAnimatedProps(() => { | ||
return { | ||
text: text.value, | ||
// Here we use any because the text prop is not available in the type | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
} as any; | ||
}); | ||
return ( | ||
<AnimatedTextInput | ||
underlineColorAndroid="transparent" | ||
editable={false} | ||
value={text.value} | ||
style={[styles.baseStyle, style || undefined]} | ||
{...rest} | ||
{...{ animatedProps }} | ||
/> | ||
); | ||
}; | ||
|
||
export default ReText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { interpolateColor } from 'react-native-reanimated'; | ||
|
||
export const mix = (value: number, x: number, y: number) => { | ||
'worklet'; | ||
return x * (1 - value) + y * value; | ||
}; | ||
|
||
type AnimatedColor = string | number; | ||
|
||
export const mixColor = ( | ||
value: number, | ||
color1: AnimatedColor, | ||
color2: AnimatedColor, | ||
colorSpace: 'RGB' | 'HSV' = 'RGB' | ||
) => { | ||
'worklet'; | ||
return interpolateColor(value, [0, 1], [color1, color2], colorSpace); | ||
}; | ||
|
||
export const clamp = (value: number, lowerBound: number, upperBound: number) => { | ||
'worklet'; | ||
return Math.min(Math.max(lowerBound, value), upperBound); | ||
}; |
Oops, something went wrong.