Skip to content

Commit 5cb6561

Browse files
ColorPicker - Remove UNSAFE method (#940)
* ColorPicker to become uncontrolled component - Phase 1: Migration warning * Wrapping with 'asBaseComponent' HOC * removing 'forwardedRef' * removing android/gradlew.bat * remove expoDemo/android/gradlew.bat * Splitting component to sub components * Removing UNSAFE componentWillReceiveProps by passing a key to ColorPickerDialog * Reorganising props * Deleting key example * editing comment Co-authored-by: Ethan Sharabi <[email protected]>
1 parent 7ee9fc1 commit 5cb6561

File tree

3 files changed

+463
-389
lines changed

3 files changed

+463
-389
lines changed

demo/src/screens/componentScreens/ColorPickerScreen.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,24 @@ export default class ColorPickerScreen extends Component {
6060
return (
6161
<ScrollView style={styles.container} contentContainerStyle={{paddingBottom: 20}}>
6262
<View center bg-white marginV-10>
63-
<Text text60 margin-10 style={{color}}>Selected Color: {color}</Text>
63+
<Text text60 margin-10 style={{color}}>
64+
Selected Color: {color}
65+
</Text>
6466
<View center marginB-10 style={{height: 50, width: 200, backgroundColor: color}}>
65-
<Text text60 style={{color: textColor}}>{color}</Text>
67+
<Text text60 style={{color: textColor}}>
68+
{color}
69+
</Text>
6670
</View>
6771
</View>
6872
<View bg-white>
69-
<Text text60 marginL-20 marginB-4 marginT-24>Theme Color</Text>
73+
<Text text60 marginL-20 marginB-4 marginT-24>
74+
Theme Color
75+
</Text>
7076
<Text marginL-20>Choose a color for your place’s theme.</Text>
71-
<ColorPalette value={paletteValue} onValueChange={this.onPaletteValueChange} colors={colors}/>
72-
<Text marginL-20 marginT-16>Custom Colors</Text>
77+
<ColorPalette value={paletteValue} onValueChange={this.onPaletteValueChange} colors={colors} />
78+
<Text marginL-20 marginT-16>
79+
Custom Colors
80+
</Text>
7381
<ColorPicker
7482
initialColor={color}
7583
colors={customColors}
@@ -82,11 +90,19 @@ export default class ColorPickerScreen extends Component {
8290
</View>
8391

8492
<View marginV-10 bg-white>
85-
<Text center text60 marginT-10>Color Name</Text>
93+
<Text center text60 marginT-10>
94+
Color Name
95+
</Text>
8696
<View spread row margin-10 style={{backgroundColor: nearestColor}}>
87-
<Text margin-5 text70 style={{color: textColor}}>{nearestColor}</Text>
88-
<Text margin-5 text60 style={{color: textColor}}>{colorName}</Text>
89-
<Text margin-5 text70 style={{color: textColor}}>{isMapped}</Text>
97+
<Text margin-5 text70 style={{color: textColor}}>
98+
{nearestColor}
99+
</Text>
100+
<Text margin-5 text60 style={{color: textColor}}>
101+
{colorName}
102+
</Text>
103+
<Text margin-5 text70 style={{color: textColor}}>
104+
{isMapped}
105+
</Text>
90106
</View>
91107
</View>
92108
</ScrollView>

0 commit comments

Comments
 (0)