0

React-native offers developing native modules and UI components in its official site.

However I want to make minor changes in the TextInput component which is used in my app and is found on my computer. However there is no a Java file that is related with TextInput.

Is there any way to make small changes in TextInput in my app?

efkan
  • 12,991
  • 6
  • 73
  • 106

2 Answers2

0

Since RN v0.21.0

The distribution of Android files have changed and is now done with npm.

The files can be found under node_modules/react-native/android/com/facebook/react/react-native/0.21.0/in a the archive react-native-0.21.0-sources.jar

They can't be changed just like this, thought you can have a look at this

Edit : Works with RN 0.20.0 or lower

I guess what you're looking for is this file

You can modify it in your react-native folder under node_modules :

node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/

Community
  • 1
  • 1
G. Hamaide
  • 7,078
  • 2
  • 36
  • 57
  • I've initialized a new project. However there is no `node_modules/react-native/ReactAndroid` folder. Do you have it? – efkan Mar 03 '16 at 16:07
  • What is your version of react-native ? – G. Hamaide Mar 03 '16 at 16:07
  • v 0.21 - I upgraded it yesterday. ` "dependencies": { "react-native": "^0.21.0"...` – efkan Mar 03 '16 at 16:08
  • Indeed, I was on 0.20.0 and the structure has changed since. I'll have another look and let you know if I find out anything. – G. Hamaide Mar 03 '16 at 16:16
  • OK, everything is now loaded with npm and can be found here : `node_modules/react-native/android/com/facebook/react/react-native/0.21.0/`. But it's a .jar file meaning it's not that easy to change it. You'd rather write your own component and adapt to to your needs. Or try and get your modification integrated in RN by submitting it [here](https://productpains.com) – G. Hamaide Mar 03 '16 at 16:22
  • Yes. Actually I saw that today when I was researching. Do you have an idea how can I change now :) – efkan Mar 03 '16 at 16:31
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/105286/discussion-between-g-hamaide-and-user3765109). – G. Hamaide Mar 03 '16 at 16:34
  • It doesn't work. I'm trying to find how can I change. If I can found, will write here.. – efkan Mar 03 '16 at 20:59
  • I should be change in a different way. Although I remove node_modules/react-native/android folder, everything works normally. FYI. – efkan Mar 04 '16 at 06:19
0

In order to apply changes to React Native android source and have them in the app, you have to compile it from source.

You can follow the official guide: https://facebook.github.io/react-native/docs/android-building-from-source.html#content

Mike Grabowski
  • 1,955
  • 16
  • 17
  • Says that `You will need to build React Native from source if you want to work on a new feature/bug fix...` - quasi I read this yesterday! – efkan Mar 04 '16 at 13:46