forked from sdp-tech/UPCY_Mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sdp-tech#14 feat : write detail page with rich editor (sdp-tech#37)
- Loading branch information
1 parent
1b2b94c
commit fa05a7e
Showing
6 changed files
with
95 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { useCallback, useRef, useState } from 'react'; | ||
import { ScrollView, TouchableOpacity, View } from 'react-native'; | ||
import { RichEditor, RichToolbar, actions } from 'react-native-pell-rich-editor'; | ||
import { Body14M, Body16B } from '../../../styles/GlobalText'; | ||
import Arrow from '../../../assets/common/Arrow.svg'; | ||
import styled from 'styled-components/native'; | ||
import { getStatusBarHeight } from 'react-native-safearea-height'; | ||
|
||
const statusBarHeight = getStatusBarHeight(true); | ||
|
||
const BackButton = styled.TouchableOpacity` | ||
position: absolute; | ||
left: 0px; | ||
padding: 25px; | ||
top: ${statusBarHeight-10}px; | ||
z-index: 1; | ||
` | ||
|
||
const WriteDetailPage = ({navigation}:any) => { | ||
const [detail, setDetail] = useState(""); | ||
const editor = useRef<RichEditor>(null); | ||
const scrollRef = useRef<ScrollView>(null); | ||
|
||
const handleCursorPosition = useCallback((scrollY: number) => { | ||
// Positioning scroll bar | ||
scrollRef.current!.scrollTo({y: scrollY - 30, animated: true}); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<View style={{flexDirection:"row", marginTop:20, borderBottomWidth:1, borderBlockColor:"#000", padding:15, justifyContent:"center"}}> | ||
<BackButton onPress={() => navigation.goBack()}> | ||
<Arrow color='black' /> | ||
</BackButton> | ||
<View> | ||
<Body16B style={{fontSize:18,textAlign:"center"}}>서비스 상세</Body16B> | ||
</View> | ||
</View> | ||
<RichToolbar | ||
editor={editor} | ||
actions={[ | ||
actions.insertImage, | ||
actions.setBold, | ||
actions.setItalic, | ||
actions.insertBulletsList, | ||
actions.insertOrderedList, | ||
actions.insertLink, | ||
actions.setStrikethrough, | ||
actions.setUnderline, | ||
]} | ||
// onPressAddImage={pickImage} | ||
/> | ||
<ScrollView> | ||
<RichEditor | ||
ref={editor} // from useRef() | ||
initialContentHTML={detail} | ||
onChange={(html_content) => { setDetail(html_content); | ||
}} | ||
placeholder="내용" | ||
initialHeight={450} | ||
useContainer={true} | ||
onCursorPosition={handleCursorPosition} | ||
/> | ||
</ScrollView> | ||
</> | ||
) | ||
} | ||
|
||
export default WriteDetailPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3594,16 +3594,16 @@ escape-html@~1.0.3: | |
resolved "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz" | ||
integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== | ||
|
||
[email protected], escape-string-regexp@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz" | ||
integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== | ||
|
||
escape-string-regexp@^1.0.5: | ||
version "1.0.5" | ||
resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz" | ||
integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== | ||
|
||
escape-string-regexp@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz" | ||
integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== | ||
|
||
escape-string-regexp@^4.0.0: | ||
version "4.0.0" | ||
resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" | ||
|
@@ -4440,7 +4440,7 @@ internal-slot@^1.0.5: | |
hasown "^2.0.0" | ||
side-channel "^1.0.4" | ||
|
||
invariant@^2.2.4: | ||
invariant@2.2.4, invariant@^2.2.4: | ||
version "2.2.4" | ||
resolved "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz" | ||
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== | ||
|
@@ -6324,6 +6324,11 @@ react-native-pager-view@^6.2.3: | |
resolved "https://registry.npmjs.org/react-native-pager-view/-/react-native-pager-view-6.2.3.tgz" | ||
integrity sha512-dqVpXWFtPNfD3D2QQQr8BP+ullS5MhjRJuF8Z/qml4QTILcrWaW8F5iAxKkQR3Jl0ikcEryG/+SQlNcwlo0Ggg== | ||
|
||
react-native-pell-rich-editor@^1.9.0: | ||
version "1.9.0" | ||
resolved "https://registry.yarnpkg.com/react-native-pell-rich-editor/-/react-native-pell-rich-editor-1.9.0.tgz#e222b4cd8ead9b5e1de7b6cf2f31a3315c82e570" | ||
integrity sha512-BKzlu++FySzPXrb5bczD8b/ZZJtfzcD4z7FvW7TrH+4OENEQtaIiEMfmb5N09Kv3YVJcfm8fut8Y+GLNAcCQHA== | ||
|
||
react-native-reanimated@^3.6.2: | ||
version "3.6.2" | ||
resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-3.6.2.tgz#8a48c37251cbd3b665a659444fa9778f5b510356" | ||
|
@@ -6386,6 +6391,14 @@ react-native-tab-view@^3.5.2: | |
dependencies: | ||
use-latest-callback "^0.1.5" | ||
|
||
react-native-webview@^13.7.1: | ||
version "13.7.1" | ||
resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-13.7.1.tgz#d7fe1eb5073e692861457d17b4b998f42846426d" | ||
integrity sha512-tnfTgjIYY3KnBfbN9hRCJf2y/6JZBev3aq2ZacLml0AZn4ufTe4MyCiE1NAZ/l5WHV/1eaqN0srxn45ATL0+Ow== | ||
dependencies: | ||
escape-string-regexp "2.0.0" | ||
invariant "2.2.4" | ||
|
||
react-native@*, [email protected]: | ||
version "0.73.2" | ||
resolved "https://registry.npmjs.org/react-native/-/react-native-0.73.2.tgz" | ||
|