Skip to content

Instantly share code, notes, and snippets.

@GantMan
Last active November 8, 2018 18:17
Show Gist options
  • Save GantMan/a6cdd68794f05d73e4c4b30d7b76c6b6 to your computer and use it in GitHub Desktop.
Save GantMan/a6cdd68794f05d73e4c4b30d7b76c6b6 to your computer and use it in GitHub Desktop.
Simple Welcome component in Java
package com.diveintonative;
import android.widget.TextView;
import com.facebook.react.uimanager.SimpleViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.annotations.ReactProp;
public class RNTWelcomeViewManager extends SimpleViewManager<TextView> {
public static final String REACT_CLASS = "RNTWelcomeView";
@Override
public String getName() {
return REACT_CLASS;
}
@Override
protected TextView createViewInstance(ThemedReactContext reactContext) {
TextView myTextView = new TextView(reactContext);
myTextView.setText("WELCOME!");
return myTextView;
}
@ReactProp(name = "text")
public void setText(TextView view, String myText) {
view.setText("WELCOME " + myText.toUpperCase() + "!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment