Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from senpaidevlabs/master
Browse files Browse the repository at this point in the history
Add some love
  • Loading branch information
agentcooper committed Jun 13, 2016
2 parents edeaeb3 + f0e463a commit 5c98ca1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Hypertext.ios.js
Expand Up @@ -20,6 +20,7 @@ var styles = StyleSheet.create({
});

var splitHypertext = require('./splitHypertext');
var randomKeyGen = function() { return Math.random().toString(36).substring(7); };

var Hypertext = React.createClass({
onPress: function(href) {
Expand All @@ -37,13 +38,13 @@ var Hypertext = React.createClass({
input: this.props.children,

onLink: function(text, href) {
return <Text style={styles.link} onPress={
return <Text style={styles.link} key={randomKeyGen()} onPress={
this.onPress.bind(this, href)
}>{text}</Text>;
},

onText: function(text) {
return <Text style={styles.text}>{text}</Text>;
return <Text style={styles.text} key={randomKeyGen()}>{text}</Text>;
}
});

Expand Down
6 changes: 3 additions & 3 deletions package.json
@@ -1,14 +1,14 @@
{
"name": "react-native-hypertext",
"description": "React Native module to render hypertext (text with links)",
"version": "0.0.2",
"version": "0.0.3",
"author": "Artem Tyurin <artem.tyurin@gmail.com> (http://github.com/agentcooper)",
"main": "Hypertext.ios.js",
"scripts": {
"start": "node_modules/react-native/packager/packager.sh"
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"react-native": "^0.4.0"
"react-native": ">=0.19"
},
"repository": {
"type": "git",
Expand Down
2 changes: 0 additions & 2 deletions splitHypertext.js
Expand Up @@ -10,7 +10,6 @@ function splitHypertext(params) {
});

return split.reduce(function(res, _, index, arr) {

if (arr[index].indexOf('<a') !== -1 && arr[index + 2].indexOf('</a>') !== -1) {
var href = arr[index].match(/href="([^\'\"]+)/)[1];

Expand All @@ -23,7 +22,6 @@ function splitHypertext(params) {
params.onText.call(that, arr[index])
);
}

return res;
}, []);
}
Expand Down

0 comments on commit 5c98ca1

Please sign in to comment.