_5_Root.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import React ,{useState, useRef, useEffect} from 'react';
  2. // import Tab from '../navigation/TabNavigator';
  3. import C from 'rn-class';
  4. import Main from './_6_Main';
  5. import List from './_7_List';
  6. import TabBar from '../components/TabBar';
  7. import Player from "../components/Player";
  8. //import Player from "./PlayerGesture";
  9. C.addColor("#d7d7d7", "color-listbg");
  10. const BTNS = [
  11. [
  12. {title: "行" ,subtitle : "working \nmeditation" , contensTitle : "행선" , contensSubTitle : "" , contens:"하루 20분 정도 걸으면서 하는 행선은 좌선 1시간 이상의 효과를 가져옵니다.", img : require("../res/Working_meditation.png")},
  13. {title: "住" ,subtitle : "standing \nmeditation", contensTitle : "주선" , contensSubTitle : "" , contens:"일상생활 속에 잠시 머무름은 인생에서 쉬어가는 의미를 가집니다. 바쁜 일상 속에서 잠시 머무름을 가지고 짧게 마음의 고요함을 찾으시길 바랍니다.", img : require("../res/Standing_meditation.png")},
  14. {title: "坐" ,subtitle : "seat and \nmeditation", contensTitle : "좌선" , contensSubTitle : "" , contens:"가부좌가 아니더라도 일상생활 속에서 편한 자세로 앉아서 정신을 집중하여 무념무상의 상태로 들어가는 선수행을 말합니다.", img : require("../res/Seatand_meditation.png")},
  15. {title: "卧" ,subtitle : "Lying \nmeditation" , contensTitle : "와선" , contensSubTitle : "" , contens:"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", img : require("../res/Lying_meditation.png")},
  16. {title: "身" ,subtitle : "body" },
  17. ],
  18. [
  19. {title:"사랑", subtitle : "Love", contensTitle : "사랑" , contensSubTitle : "(애별리고)" , contens:"우리는 우리와 가까운, 우리가 원하는, 우리가 좋아하는, 우리를 편리하게 해 주고 행복하게 해 주던 많은 것들과 이별을 해야 하는 괴로움을 버려야 합니다.", img : require("../res/Working_meditation.png")},
  20. {title:"미움", subtitle : "Hate", contensTitle : "미움" , contensSubTitle : "(원증회고)" , contens:"싫어하는 것을 해야 하는 것, 싫어하는 사람과 함께 있는 것이란 얼마나 큰 괴로움인가. 이는 가장 큰 괴로움이며 여기서 벗어나야 합니다.", img : require("../res/Standing_meditation.png")},
  21. {title:"탐욕", subtitle : "Avarice", contensTitle : "탐욕" , contensSubTitle : "(구부득고)" , contens:"좋아하는 사람, 물건, 재산, 명예, 권력, 지위, 출세, 행복, 건강 등 얻고자 하고 바라지만 마음대로 구할 수 없는데서 괴로움은 시작된다.", img : require("../res/Seatand_meditation.png")},
  22. {title:"탐식", subtitle : "Voracity", contensTitle : "탐식" , contensSubTitle : "(구부득고)" , contens:"현대사회에서 물질적 풍요와 상반되게 정신적 빈곤으로 인한 강박장애, 불안장애 같은 정신적 증상은 얻고자 하는 욕심으로 인하여 나타나는 화병의 일환", img : require("../res/Lying_meditation.png")},
  23. {title: "心" , subtitle : "Mind"},
  24. ]
  25. ]
  26. const tabPosition = {x:0, y:0, w:0, h:0};
  27. export default (props)=>{
  28. const [ sel_idx, setsel_Idx ] = useState(0);
  29. const [ targetIdx, setTargetIdx ] = useState(0);
  30. const [ bPlay, setbPlay] = useState(false);
  31. const [ curPlayInfo, setCurPlayInfo] = useState({});
  32. const onTabPress = (tIdx, i)=>{
  33. setsel_Idx(i);
  34. setTargetIdx(tIdx);
  35. setbPlay(false);
  36. }
  37. const startPlay = (p)=>{
  38. setbPlay(true);
  39. setCurPlayInfo(p.Pages);
  40. }
  41. let Page;
  42. if(sel_idx == -1){
  43. Page = Main;
  44. }else{
  45. Page = List;
  46. }
  47. useEffect(()=>{
  48. },[]);
  49. const setTabPosition = (data) => {
  50. tabPosition.x = data.x;
  51. tabPosition.y = data.y;
  52. tabPosition.w = data.w;
  53. tabPosition.h = data.h;
  54. }
  55. return (
  56. <C.View cls="flx1 bgc-color-white">
  57. <C.Comp.Header {...props}/>
  58. <Page {...props} Pages={sel_idx == -1 ? {} : BTNS[targetIdx][sel_idx]} startPlay={startPlay} bPlay={bPlay}/>
  59. {bPlay ? <Player {...props} Pages={curPlayInfo} tabPosition={tabPosition} closePlayer={()=>setbPlay(false)}/> : null}
  60. {/* {bPlay ? <C.View cls="flx0.1"/> : null} */}
  61. <TabBar setTabPosition={setTabPosition} onTabPress={onTabPress} BTNS={BTNS}/>
  62. </C.View>
  63. )
  64. }