File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -36,27 +36,26 @@ export default class SwitchSelector extends Component {
3636 this . state = {
3737 selected : this . props . initial ? this . props . initial : 0
3838 } ;
39- this . animatedValue = new Animated . Value (
40- this . props . initial
41- ? I18nManager . isRTL
42- ? - ( this . props . initial / this . props . options . length )
43- : this . props . initial / this . props . options . length
44- : 0
45- ) ;
46- }
4739
48- componentWillMount ( ) {
4940 this . _panResponder = PanResponder . create ( {
5041 onStartShouldSetPanResponder : this . shouldSetResponder ,
5142 onMoveShouldSetPanResponder : this . shouldSetResponder ,
5243 onPanResponderRelease : this . responderEnd ,
5344 onPanResponderTerminate : this . responderEnd
5445 } ) ;
46+
47+ this . animatedValue = new Animated . Value (
48+ this . props . initial
49+ ? I18nManager . isRTL
50+ ? - ( this . props . initial / this . props . options . length )
51+ : this . props . initial / this . props . options . length
52+ : 0
53+ ) ;
5554 }
5655
57- componentWillReceiveProps ( nextProps ) {
58- if ( nextProps . value !== this . props . value ) {
59- this . toggleItem ( nextProps . value , ! this . props . disableValueChangeOnPress ) ;
56+ componentDidUpdate ( prevProps ) {
57+ if ( prevProps . value !== this . props . value ) {
58+ this . toggleItem ( prevProps . value , ! this . props . disableValueChangeOnPress ) ;
6059 }
6160 }
6261
You can’t perform that action at this time.
0 commit comments