All Projects → ShaMan123 → react-native-math-view

ShaMan123 / react-native-math-view

Licence: MIT license
Math view for react native! No WebView!

Programming Languages

typescript
32286 projects
java
68154 projects - #9 most used programming language
javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language
Starlark
911 projects
HTML
75241 projects

Projects that are alternatives of or similar to react-native-math-view

react-mathjax-preview
The MathJax React component you were looking for.
Stars: ✭ 46 (-6.12%)
Mutual labels:  mathjax, mathml
mathjax-node-cli
CLI tools for mathjax-node
Stars: ✭ 27 (-44.9%)
Mutual labels:  math, mathjax
Mathjax
Beautiful and accessible math in all browsers
Stars: ✭ 8,551 (+17351.02%)
Mutual labels:  mathjax, mathml
mathup
Easy MathML authoring tool with a quick to write syntax
Stars: ✭ 46 (-6.12%)
Mutual labels:  mathml, mathematical-expressions
Texme
Self-rendering Markdown + LaTeX documents
Stars: ✭ 1,970 (+3920.41%)
Mutual labels:  math, mathjax
MathJax-dev
Build and release tools for the MathJax project
Stars: ✭ 34 (-30.61%)
Mutual labels:  mathjax, mathml
android-expr-eval
Android application to solve math expressions
Stars: ✭ 17 (-65.31%)
Mutual labels:  math, math-expressions
mathconverter
Converts from AsciiMath, LaTeX, MathML to LaTeX, MathML
Stars: ✭ 35 (-28.57%)
Mutual labels:  mathjax, mathml
python-markdown-math
Math extension for Python-Markdown
Stars: ✭ 98 (+100%)
Mutual labels:  math, mathjax
arabic-mathjax
Beautiful Arabic Math on all browsers. An extension for MathJax v2.
Stars: ✭ 12 (-75.51%)
Mutual labels:  math, mathjax
nim-mathexpr
Tiny math expression evaluator library implemented in pure Nim
Stars: ✭ 58 (+18.37%)
Mutual labels:  math, mathematical-expressions
Jekyll Spaceship
🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
Stars: ✭ 196 (+300%)
Mutual labels:  math, mathjax
Asciidocfx
Asciidoc Editor and Toolchain written with JavaFX 16 (Build PDF, Epub, Mobi and HTML books, documents and slides)
Stars: ✭ 1,533 (+3028.57%)
Mutual labels:  mathjax, mathml
hexo-filter-mathjax
💯 Server side MathJax renderer plugin for Hexo.
Stars: ✭ 76 (+55.1%)
Mutual labels:  math, mathjax
Rich Text Editor
Math editor (http://digabi.github.io/rich-text-editor/)
Stars: ✭ 45 (-8.16%)
Mutual labels:  math, mathjax
MathImprove
Modify and Improve math expressions.
Stars: ✭ 13 (-73.47%)
Mutual labels:  math, math-expressions
HLML
Auto-generated maths library for C and C++ based on HLSL/Cg
Stars: ✭ 23 (-53.06%)
Mutual labels:  math
zerolib-flixel
Some helper classes for HaxeFlixel that I like to use ✨
Stars: ✭ 28 (-42.86%)
Mutual labels:  math
meval-rs
Math expression parser and evaluation library for Rust
Stars: ✭ 118 (+140.82%)
Mutual labels:  math-expressions
mathpad
Interactive scratchpad calculator for VS Code
Stars: ✭ 20 (-59.18%)
Mutual labels:  math-expressions

react-native-math-view

NPM

WIP V3

A react native view used to easily display and handle math. The library doesn't use WebView.

MathView Example Lists Example MathText
Runner Lists Example MathText

Installation

npm install --save react-native-math-view OR yarn add react-native-math-view

react-native > 0.59

iOS:

Install react-native-svg

$ cd ios && pod install

Expo

Expo doesn't support native modules. You can use this library with react-native-svg (performance suffers a bit), see #19.

Errors during installation:

  1. Upgrade typescript
  2. If you're getting an error regarging compileMathjax you can disregard it as long as compiled mathjax successfully was printed to the console. If you're using yarn it's probable no logging will show.
  3. To be sure everything is compiled properly run the following command from the mathjax-full node_module directory of your project:
npm run compile

typescript errors can be safely disregareded.
see also #16

Getting Started

import MathView, { MathText } from 'react-native-math-view';

  return (
    ...
    	<MathView
	   math={'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}'}
	/> 
	<MathView
	   math='\cos\left(x\right)=\frac{b}{c}'
	/> 
	<MathView
	   math='\cos\left(x=\frac{b}{c}'
	   renderError={({ error }) => <Text style={[{ fontWeight: 'bold' }]}>{error}</Text>}
	/> 
	<MathText
            value={`This text includes math notations and should be wrapped correctly for \\( \\alpha \\) and $\\beta$ within the view. \nThe following formula shouldn't be inline:$$x_{1,2} = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}$$However the following formula should be inline with the text: \\( a^2 + b^2 = c^2 \\)`}
            direction="ltr"
            CellRendererComponent={<TouchableOpacity />}
        />
    ...
  );

TroubleShooting

  1. Make sure to properly escape all LaTeX strings (Syntax sensitive):

This occurs because when passing math={value}, value gets evaluated as opposed to math='LaTeX'.
It is cosidered best practice to avoid using math='LaTeX'.

        <MathView
-	   math='x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}'
+	   math='x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}'
	/> 
	
	//	OR
	
        <MathView
-	   math={'x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}'}
+	   math={'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}'}
	/> 
  1. Try your LaTeX in the MathJax sandbox.
    You can run setMode('SVG') from dev console in order to render svg.

Running example app

From the project's directory run:

yarn --production=false
cd MathExample
yarn --production=false
npm run android

MathJax Supported LaTeX Commands

Implementation:

  • iOS native MathView - POC successful, need to implement native measuring. For now fallbacking to react-native-svg

  • Android MathView - native since V2, based on Android SVGImageView. Need to implement editable state.

Looking for Web support?

Check out react-math-view!

FollowUp

iOS editable math view

Native android math view

Web Math Editors -> MathLive looks very promising!

KaTeX - Math keypad that works with <WebView>. See this

React with LaTeX - using server side rendering to speed things up.

Writing math dynamically

SSR:
\Large x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].