Skip to content
This repository has been archived by the owner on Jul 3, 2021. It is now read-only.

Commit

Permalink
- upgrading native android library
Browse files Browse the repository at this point in the history
  • Loading branch information
prscms committed May 15, 2018
1 parent 04e345c commit 2fe5c4d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 9 deletions.
10 changes: 8 additions & 2 deletions RNMorphingText.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ class RNMorphingText extends Component {

animationDuration: PropTypes.number,
lineColor: PropTypes.string,
lineWidth: PropTypes.number
lineWidth: PropTypes.number,
font: PropTypes.string,
textAlign: PropTypes.string
};

static defaultProps = {
font: '',
textAlign: '',
value: "",
effect: "scale",
size: 12,
Expand Down Expand Up @@ -82,7 +86,9 @@ class RNMorphingText extends Component {
size: this.props.size,
animationDuration: this.props.size,
lineColor: this.props.lineColor,
lineWidth: this.props.lineWidth
lineWidth: this.props.lineWidth,
font: this.props.font,
textAlign: this.props.textAlign
}}
/>
);
Expand Down
6 changes: 6 additions & 0 deletions android/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin"/>
</classpath>
23 changes: 23 additions & 0 deletions android/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>android</name>
<comment>Project android created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Tue May 15 16:15:11 IST 2018
connection.project.dir=
14 changes: 7 additions & 7 deletions android/src/main/java/ui/morphingtext/RNMorphingText.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ui.morphingtext;

import android.app.Activity;
import android.graphics.Color;
import android.text.Layout;
import android.view.View;
Expand Down Expand Up @@ -93,17 +92,16 @@ public void setProps(FrameLayout frame, final ReadableMap props) {
}

textView.setTextSize(props.getInt("size"));
textView.onPreDraw();
if (props.getString("font") != null) {
Typeface typeface = ReactFontManager.getInstance().getTypeface(props.getString("font"), 0, activity.getAssets());

if (!props.getString("font").equalsIgnoreCase("")) {
Typeface typeface = ReactFontManager.getInstance().getTypeface(props.getString("font"), 0, this.reactContext.getApplicationContext().getAssets());
if (typeface != null) {
textView.setTypeface(typeface);
}

}
String textAlign = props.getString("textAlign");

if (textAlign != null) {
String textAlign = props.getString("textAlign");
if (!textAlign.equalsIgnoreCase("")) {
switch(textAlign) {
case "left":
textView.setGravity(Gravity.LEFT);
Expand All @@ -119,6 +117,8 @@ public void setProps(FrameLayout frame, final ReadableMap props) {
}
}

textView.onPreDraw();

final HTextView animateText = textView;
frame.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
Expand Down

0 comments on commit 2fe5c4d

Please sign in to comment.