Gustash / react-native-image-keyboard

React Native TextInput expansion to enable media input.
MIT License
147 stars 14 forks source link

_onImageChange Not Working/Being Recognised #45

Open razasekha opened 4 months ago

razasekha commented 4 months ago

I am running React-Native 0.73 and am trying to use the image keyboard in my app. I have just been testing on Android for now.

Since installing the library and importing the react-native-image-keyboard, I can browse gifs and stickers, but when I click on one, nothing happens. I have added logs, none of which are being activated. I have tried an exact copy of the android example and that had the same issue.

index.js

import 'react-native-image-keyboard';
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import messaging from '@react-native-firebase/messaging';

// Register background handler
messaging().setBackgroundMessageHandler(async remoteMessage => {
    console.log('Message handled in the background!', remoteMessage);
  });

AppRegistry.registerComponent(appName, () => App);

And in My screen:

import {TextInput} from 'react-native';
  const [newMessage, setNewMessage] = useState(''); // Text for a new message

  const _onImageChange = event => {
    console.log('Test')
    const {uri, linkUri, mime, data} = event.nativeEvent;
    console.log('Yay, image received!', uri, linkUri, mime, data);

    // Do something with this data
  };

            <TextInput
              onImageChange={_onImageChange}
              style={styles.messageInput}
              value={newMessage}
              onChangeText={setNewMessage}
              placeholder="Type a message..."
              placeholderTextColor={'white'}
            />