1
1
import _ from 'lodash' ;
2
2
import React , { Component } from 'react' ;
3
3
import { StyleSheet , ScrollView } from 'react-native' ;
4
- import { Colors , View , Text , ColorPicker , ColorPalette , ColorName , ColorInfo } from 'react-native-ui-lib' ;
4
+ import { Colors , View , Text , ColorPicker , ColorPalette , ColorName , ColorInfo , TouchableOpacity , ColorPickerDialog } from 'react-native-ui-lib' ;
5
5
import { renderMultipleSegmentOptions } from '../ExampleScreenPresenter' ;
6
6
7
7
interface State {
@@ -10,6 +10,7 @@ interface State {
10
10
customColors : string [ ] ;
11
11
paletteChange : boolean ;
12
12
backgroundColor : string ;
13
+ showPicker : boolean ;
13
14
}
14
15
15
16
const INITIAL_COLOR = Colors . $backgroundPrimaryHeavy ;
@@ -31,7 +32,8 @@ export default class ColorPickerScreen extends Component<{}, State> {
31
32
textColor : Colors . $textDefaultLight ,
32
33
customColors : [ ] ,
33
34
paletteChange : false ,
34
- backgroundColor : Colors . $backgroundDefault
35
+ backgroundColor : Colors . $backgroundDefault ,
36
+ showPicker : false
35
37
} ;
36
38
37
39
onDismiss = ( ) => {
@@ -123,6 +125,25 @@ export default class ColorPickerScreen extends Component<{}, State> {
123
125
</ Text >
124
126
</ View >
125
127
</ View >
128
+
129
+ < Text center text60 marginT-10 > Color Picker Dialog</ Text >
130
+ < View center >
131
+ < TouchableOpacity
132
+ margin-10
133
+ center
134
+ style = { { width : 60 , height : 60 , borderWidth : 1 , borderRadius : 30 , backgroundColor : color } }
135
+ onPress = { ( ) => this . setState ( { showPicker : true } ) }
136
+ >
137
+ < Text > Press</ Text >
138
+ </ TouchableOpacity >
139
+ </ View >
140
+ < ColorPickerDialog
141
+ visible = { this . state . showPicker }
142
+ initialColor = { color }
143
+ key = { color }
144
+ onDismiss = { ( ) => this . setState ( { showPicker : false } ) }
145
+ onSubmit = { this . onSubmit }
146
+ />
126
147
</ ScrollView >
127
148
) ;
128
149
}
0 commit comments