Creating a custom TextInput component as a native Expo module

Please provide the following:

  1. SDK Version: 49.0.6
  2. Platforms(Android/iOS/web/all): iOS
  3. Add the appropriate “Tag” based on what Expo library you have a question on. None seemed relevant

I’m in the process of creating an Expo Module. What I want to create is a custom TextInput component that does transformations as a type (since that experience is subpar in React Native in general due to its async nature).

I’m able to create the module and associated view, and I can get the functionality that I want out of it by having a sub view that is the real UITextField (similar to the Expo WebView tutorial), but the problem I’m having is now tied to styling. While I can style the containing component with a style tag, I can’t seem to style the input itself, the hardest thing being setting the font of the input.

I also tried making the actual view that the Expo Module uses inherit from UITextField, and that didn’t do anything. I also tried inheriting from RCTSinglelineTextInputView, and I couldn’t even get that to compile.

Does anyone have an example of making a custom TextInput as an Expo Module? Or any ideas on how I can pass through styles (particularly fonts) to my sub view? A custom TextInput seems like something that should be common enough to want to do, but I can’t find any examples anywhere.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.