That’s great for you. It probably requires the server to cooperate in parsing the dom structure (if you don’t do it on the front end, the performance may not be good, and the server can still cache it)
I also tried to put simple html in react native (knowing the general structure, there may be nested styles, and all the tags, attributes, and even the order of attributes that will appear are given)
But when I was doing the mixing of p, img, b/blockquote, and a, there was only one layer of nesting. I gave up after an hour of doing it, and I honestly made a WebView to put it in
So the key to the problem is that considering that Java does not have a balanced group, it is painful to use regular expressions to display the elements. It is too tiring to analyze the dom structure without using regular expressions, so if you want to do it, you need a dom parsing library. Get the DOM tree, and then use the DOM tree to convert each element into a native element. . .
Let me just talk about something I encountered. For example, in p, if p has a width set, then if the elements inside are not enough for one line, should they be squeezed below? Or if there are two p without float, will it automatically wrap? , but there is no such thing as for you to identify when parsing. .
I don’t know personally. If you are not going to display it through webview, why should you use html format? Will it be more efficient through other formats? If you need to manually parse the html format, TextView can set the html style, but generally speaking, it is a bit too troublesome to display the corresponding elements one by one, and also set the corresponding attributes for the corresponding style.
If it’s a mix of images and text, there’s nothing better than webview. If images and texts can be separated, it also depends on your design needs. Generally speaking, Android uses TextView+ImageView, plus combinations such as gridview. Those so-called plug-ins are basically based on these combinations
That’s great for you. It probably requires the server to cooperate in parsing the dom structure (if you don’t do it on the front end, the performance may not be good, and the server can still cache it)
I also tried to put simple html in react native (knowing the general structure, there may be nested styles, and all the tags, attributes, and even the order of attributes that will appear are given)
But when I was doing the mixing of p, img, b/blockquote, and a, there was only one layer of nesting. I gave up after an hour of doing it, and I honestly made a WebView to put it in
So the key to the problem is that considering that Java does not have a balanced group, it is painful to use regular expressions to display the elements. It is too tiring to analyze the dom structure without using regular expressions, so if you want to do it, you need a dom parsing library. Get the DOM tree, and then use the DOM tree to convert each element into a native element. . .
Let me just talk about something I encountered. For example, in p, if p has a width set, then if the elements inside are not enough for one line, should they be squeezed below? Or if there are two p without float, will it automatically wrap? , but there is no such thing as
for you to identify when parsing. .
I don’t know personally. If you are not going to display it through webview, why should you use html format? Will it be more efficient through other formats?
If you need to manually parse the html format, TextView can set the html style, but generally speaking, it is a bit too troublesome to display the corresponding elements one by one, and also set the corresponding attributes for the corresponding style.
If it’s a mix of images and text, there’s nothing better than webview. If images and texts can be separated, it also depends on your design needs. Generally speaking, Android uses TextView+ImageView, plus combinations such as gridview. Those so-called plug-ins are basically based on these combinations