-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rich-text): add android component
- Loading branch information
1 parent
e34e935
commit b197a6b
Showing
3 changed files
with
22 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 7 additions & 8 deletions
15
android/src/main/java/com/richtextinput/RichTextInputViewManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
package com.richtextinput | ||
|
||
import android.graphics.Color | ||
import android.view.View | ||
import android.widget.EditText | ||
import com.facebook.react.uimanager.SimpleViewManager | ||
import com.facebook.react.uimanager.ThemedReactContext | ||
import com.facebook.react.uimanager.annotations.ReactProp | ||
|
||
class RichTextInputViewManager : SimpleViewManager<View>() { | ||
class RichTextInputViewManager : SimpleViewManager<EditText>() { | ||
override fun getName() = "RichTextInputView" | ||
|
||
override fun createViewInstance(reactContext: ThemedReactContext): View { | ||
return View(reactContext) | ||
override fun createViewInstance(reactContext: ThemedReactContext): EditText { | ||
return EditText(reactContext) | ||
} | ||
|
||
@ReactProp(name = "color") | ||
fun setColor(view: View, color: String) { | ||
view.setBackgroundColor(Color.parseColor(color)) | ||
@ReactProp(name = "placeholder") | ||
fun setPlaceholder(view: EditText, placeholder: String) { | ||
view.hint = placeholder | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters