peacechen / react-native-modal-selector

A cross-platform (iOS / Android), selector/picker component for React Native that is highly customizable and supports sections.
MIT License
369 stars 129 forks source link

accessibilityLabel error #143

Closed kadir-akbulut closed 4 years ago

kadir-akbulut commented 4 years ago

Hi, importantForAccessibility error importantForAccessibility = {isFirstItem? 'yes': 'no'}.I solved it with But this time it gives accessibilityLabel error. Please can you help? This problem is happening at 0.62. Android error_android

kadir-akbulut commented 4 years ago

It works when the value is not set.

<Overlay {...overlayProps}> <View style={[styles.overlayStyle, this.props.overlayStyle]}> <View style={[styles.optionContainer, this.props.optionContainerStyle]}>

{options}
                </View>
                <View style={[styles.cancelContainer, this.props.cancelContainerStyle]}>
                    <TouchableOpacity onPress={this.close} activeOpacity={this.props.touchableActiveOpacity} accessible={this.props.cancelButtonAccessible}>
                        <View style={[styles.cancelStyle, this.props.cancelStyle]}>
                            <Text style={[styles.cancelTextStyle, this.props.cancelTextStyle]}>{this.props.cancelText}</Text>
                        </View>
                    </TouchableOpacity>
                </View>
            </View>
        </Overlay>);

removed

peacechen commented 4 years ago

The error says that it's receiving a boolean but is expecting a string. The documentation says that the prop type is a string: https://reactnative.dev/docs/accessibility

Try passing in empty strings for both scrollViewAccessibilityLabel and cancelButtonAccessibilityLabel.

If that works, the defaults will need to be fixed. Would you mind testing this out -- In your node_modules/react-native-modal-selector/index.js, change the lines at: https://github.com/peacechen/react-native-modal-selector/blob/master/index.js#L118

... so that the default values are strings "" instead of undefined. Remove the accessibility props you passed in earlier and see if it works the same.

peacechen commented 4 years ago

This has been fixed and published in 2.0.2.

bbaoNg97 commented 3 years ago

im not sure why when i updated to latest version (2.0.3), it still showing the same error (importantForAccessibility), but then when i change value importantForAccessibility to "yes" in node_modules/react-native-modal-selector/index.js, it success, but the most funny part is when i change it back, the error is gone already and works successfully

lrphael commented 3 years ago

im not sure why when i updated to latest version (2.0.3), it still showing the same error (importantForAccessibility), but then when i change value importantForAccessibility to "yes" in node_modules/react-native-modal-selector/index.js, it success, but the most funny part is when i change it back, the error is gone already and works successfully

The same to me. Working.

guptanisha commented 3 years ago

This has been fixed and published in 2.0.2.

Though it has been closed almost a year @peacechen. I didn't work for React Native 0.63(https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz), react-native-modal-selector "^2.0.3" nor with 2.0.2

Please help suggest.

peacechen commented 3 years ago

Maybe the requirements for importantForAccessibility changed in later versions of RN. Looks like RN 0.63 was release July 2020 which was after RNMS 2.0.2. Would appreciate some help looking up the newer requirements for importantForAccessibility.

guptanisha commented 3 years ago

@peacechen https://github.com/facebook/react-native/issues/30850

peacechen commented 3 years ago

Should importantForAccessibility be set on all child components? Please submit a PR with the fix.