Osedea / react-native-opengraph-kit

A set of components and utils useful to extract opengraph data directly from your react-native app
MIT License
47 stars 22 forks source link

OpenGraphAwareInput >> TextInput Props #34

Open VooduVibe opened 4 years ago

VooduVibe commented 4 years ago

Description of the issue

Hi Osedea team and contributors. Thank you for this great kit. I am just trying to figure out how to pass some of the typical TextInput props through the OpenGraphAwareInput component. For example:

placeholder="Type your post..." placeholderTextColor="#d6d6d6" maxLength={240} numberOfLines={3} autoCapitalize="sentences"

Code snippet

I have tried the above props as follows, but it seems that these props are unsupported:

<OpenGraphAwareInput
   containerStyle ={styles.inputContainer}
   placeholder="Type your post..."
   placeholderTextColor="#d6d6d6"
   maxLength={240}
   numberOfLines={3}
   autoCapitalize="sentences"/>

My apologies, I am not an expert so any guidance or alternative treatments that would allow me to customise the aware input box would be very much appreciated. Thank you in advance.

Versions

adrienthiery commented 3 years ago

Hi there,

You're right, this one would need a bit of a refresher.

I don't have the availability to do the change right now, but the solution would be to add the following change to : https://github.com/Osedea/react-native-opengraph-kit/blob/master/OpenGraphAwareInput.js

+     const { containerStyle, iconStyle, iconSource, onIconPress, textInputStyle, ...rest } = this.props;
        return (
-            <View style={[styles.container, this.props.containerStyle]}>
+            <View style={[styles.container, containerStyle]}>
                <TextInput
                    onChange={this.handleTextInputChange}
-                    style={[styles.input, this.props.textInputStyle]}
+                    style={[styles.input, textInputStyle]}
                    {...rest}
                />
                {ogDataToDisplay.map((meta, i) => (
                    <OpenGraphDisplay
                        key={i}
                        data={meta}
                        onIconPress={
                            this.props.showIcon
-                                ? this.props.onIconPress
+                                ? onIconPress
                                  || this.handleDismissOpengraph
                                : null
                        }
+                        iconSource={iconSource}
-                        iconSource={this.props.iconSource}
+                        iconStyle={iconStyle}
-                        iconStyle={this.props.iconStyle}
                    />
                ))}
            </View>

Would you be up for creating a PR ? 😄