Closed keisan1231 closed 4 years ago
It does not appear to have that currently, but as the native buttons inherit from UIKit and that exposes the property it should be possible to implement it? https://developer.apple.com/documentation/uikit/uicontrol/1618217-isenabled
Have you tried patching the Obj-C to see if it works?
(by which I mean even just a simple test that does not attempt to bring it up to the javascript layer, just to see if you set enabled to false if it draws differently etc and is worth pursuing - after knowing that, if it is effective then getting it up to javascript shouldn't be much effort) I think it's possible to hack it in here as a test using whatever button you currently use, just trying to toggle enabled near that button style's setting of cornerRadius https://github.com/invertase/react-native-apple-authentication/blob/master/ios/RNAppleAuthentication/RNAppleAuthButtonViewManager.m
@keisan1231 any comment?
Hey there, I tried to set the isEnabled prop in RNAppleAuthButtonViewManager.m:
RCT_EXPORT_VIEW_PROPERTY(isEnabled, BOOL)
It didn't do anything. I checked if I was passing isEnabled properly and AppleButton.js was getting the props just fine. Not at all knowledgable with Obj_C, does that indicated that the native AppleAuthButton doesn't support the isEnabled view property?
isEnabled is not a property recognized by this button as near as I can tell.
I substitute a simulated button with activity indicator to deal with it
export default class SocialButton extends RX.Component<SocialButtonProps, SocialButtonState> {
render(): JSX.Element | null {
switch (this.props.socialNetwork) {
case 'apple':
if (!AppleAuth.isSupported) {
return null;
}
if (this.props.activityIndicator) {
return (
<RX.Button
style={[Styles.homeRegisterButton, { backgroundColor: 'black' }]}
disabled={this.props.disabled}
>
<RX.View style={Styles.simpleHorizontalSplit}>
<RX.Image
resizeMethod={'resize'}
style={[Styles.signinIcon, { marginLeft: 50, marginRight: 0 }]}
source={Images.appleIcon}
/>
<RX.View
style={{ flex: 1, alignContent: 'center', alignSelf: 'center', margin: 12 }}
>
<RX.ActivityIndicator size={'medium'} color={'#00ACE6'} />
</RX.View>
</RX.View>
</RX.Button>
);
}
return (
<AppleButton
buttonType={AppleButton.Type.CONTINUE}
buttonStyle={AppleButton.Style.BLACK}
cornerRadius={6}
style={{
width: 304,
height: 50,
margin: 8,
borderRadius: 6,
}}
onPress={this._onPress}
/>
);
That makes sense! Thanks for the answer!
Is this button has disabled property???