Skip to content

Commit 3452a70

Browse files
andangrdandangrd
andauthored
chore(v1.8.0): update parser and fix bug (#38)
* update dependencies, avoid vulnerabilities * replace componentWillMount * update RN 0.61.2 * add default styling of outer view to be stretched * docs(ReadMe): Update Readme * chore(simple-markdown): update dependency, simple markdown to 0.7.1 * fix(List): fix styling for list not applied to the first list * chore(Docs): update readme Co-authored-by: andangrd <[email protected]>
1 parent 21392ac commit 3452a70

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

README.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ export default class App extends Component<{}> {
123123
);
124124
}
125125
}
126+
const singleStyle = {
127+
text: {
128+
color: 'blue',
129+
textAlign: "right"
130+
},
131+
view: {
132+
alignSelf: 'stretch',
133+
}
134+
};
126135

127136
const markdownStyle = {
128137
singleLineMd: {
@@ -172,7 +181,7 @@ const markdownStyle = {
172181
backgroundColor: 'grey',
173182
},
174183
}
175-
};
184+
});
176185

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

210219
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.
211220

221+
`onLinkCallback` should be a function that returns a promise.
222+
223+
224+
```
225+
226+
const onLinkCallback = (url) => {
227+
console.log('test test test');
228+
229+
const isErrorResult = false;
230+
231+
return new Promise((resolve, reject) => {
232+
isErrorResult ? reject() : resolve();
233+
});
234+
};
235+
236+
...
237+
238+
<Markdown
239+
styles={markdownStyle.collectiveMd}
240+
onLink={onLinkCallback}>
241+
{text}
242+
</Markdown>
243+
244+
...
245+
246+
247+
```
248+
249+
212250
*NOTE :*
213251
_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)_
214252

@@ -258,6 +296,8 @@ This project was actually forked from [lwansbrough](https://github.com/lwansbrou
258296
* 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)
259297

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

262302

263303

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"lodash": "^4.17.15",
1111
"prop-types": "^15.6.0",
1212
"react-native-lightbox": "^0.7.0",
13-
"simple-markdown": "^0.6.0"
13+
"simple-markdown": "^0.7.1"
1414
},
1515
"repository": {
1616
"type": "git",

rules.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ module.exports = function (styles, opts = {}) {
192192
var numberIndex = 1;
193193
var items = map(node.items, function (item, i) {
194194
var bullet;
195+
state.withinList = false;
196+
195197
if (node.ordered) {
196198
bullet = React.createElement(Text, {key: 0, style: styles.listItemNumber}, (numberIndex) + '. ');
197199
}

0 commit comments

Comments
 (0)