Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ export default class App extends Component<{}> {
);
}
}
const singleStyle = {
text: {
color: 'blue',
textAlign: "right"
},
view: {
alignSelf: 'stretch',
}
};

const markdownStyle = {
singleLineMd: {
Expand Down Expand Up @@ -172,7 +181,7 @@ const markdownStyle = {
backgroundColor: 'grey',
},
}
};
});

const styles = StyleSheet.create({
container: {
Expand Down Expand Up @@ -209,6 +218,35 @@ Default style properties will be applied to the markdown. You could replace it w

This prop will accept a function. This is a callback function for any link inside markdown syntax, so you could costumize the handler for onClick event from the link.

`onLinkCallback` should be a function that returns a promise.


```

const onLinkCallback = (url) => {
console.log('test test test');

const isErrorResult = false;

return new Promise((resolve, reject) => {
isErrorResult ? reject() : resolve();
});
};

...

<Markdown
styles={markdownStyle.collectiveMd}
onLink={onLinkCallback}>
{text}
</Markdown>

...


```


*NOTE :*
_Email link (mailto) could be tested on real device only, it won't be able to test on Simulator as discuss in this [StackOverflow](https://stackoverflow.com/questions/44769710/opneurl-react-native-linking-call-mailto)_

Expand Down Expand Up @@ -258,6 +296,8 @@ This project was actually forked from [lwansbrough](https://github.com/lwansbrou
* Allow user to replace default rules, update default font family for `codeBlock` on android [(v1.6.0)](https://github.com/andangrd/react-native-markdown-package/releases/tag/v1.6.0)

* Update to use latest simple-markdown [(v1.7.0)](https://github.com/andangrd/react-native-markdown-package/releases/tag/v1.7.0)

* Update to use latest simple-markdown [(v1.8.0)](https://github.com/andangrd/react-native-markdown-package/releases/tag/v1.8.0)



Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lodash": "^4.17.15",
"prop-types": "^15.6.0",
"react-native-lightbox": "^0.7.0",
"simple-markdown": "^0.6.0"
"simple-markdown": "^0.7.1"
},
"repository": {
"type": "git",
Expand Down
2 changes: 2 additions & 0 deletions rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ module.exports = function (styles, opts = {}) {
var numberIndex = 1;
var items = map(node.items, function (item, i) {
var bullet;
state.withinList = false;

if (node.ordered) {
bullet = React.createElement(Text, {key: 0, style: styles.listItemNumber}, (numberIndex) + '. ');
}
Expand Down